import request from '@/utils/request'

// 查询仪器出入库记录列表
export function listOutin(query) {
  return request({
    url: '/resource/instrument/outin/list',
    method: 'get',
    params: query
  })
}

// 查询仪器待出库记录列表
export function listOut(query) {
  return request({
    url: '/resource/instrument/outin/outList',
    method: 'get',
    params: query
  })
}

// 查询仪器待出库记录列表
export function listIn(query) {
  return request({
    url: '/resource/instrument/outin/inList',
    method: 'get',
    params: query
  })
}

export function outCount(query) {
  return request({
    url: '/resource/instrument/outin/outSelectedCount',
    method: 'get',
    params: query
  })
}

export function inCount(query) {
  return request({
    url: '/resource/instrument/outin/inSelectedCount',
    method: 'get',
    params: query
  })
}



// 查询仪器出入库记录详细
export function getOutin(outinId) {
  return request({
    url: '/instrument/outin/' + outinId,
    method: 'get'
  })
}

// 新增仪器出入库记录
export function addOutin(data) {
  return request({
    url: '/instrument/outin',
    method: 'post',
    data: data
  })
}

// 修改仪器出入库记录
export function updateOutin(data) {
  return request({
    url: '/instrument/outin',
    method: 'put',
    data: data
  })
}

// 删除仪器出入库记录
export function delOutin(outinIds) {
  return request({
    url: '/resource/instrument/outin/delete/out/' + outinIds,
    method: 'delete'
  })
}

export function delAllSelected() {
  return request({
    url: '/resource/instrument/outin/out/deleteAll',
    method: 'delete'
  })
}


// 删除仪器出入库记录
export function delIn(outinIds) {
  return request({
    url: '/resource/instrument/outin/delete/in/' + outinIds,
    method: 'delete'
  })
}

export function delAllSelectedIn() {
  return request({
    url: '/resource/instrument/outin/in/deleteAll',
    method: 'delete'
  })
}


// 仪器出入库领用
export function useOut(instrumentIds) {
  return request({
    url: '/resource/instrument/outin/out/' + instrumentIds,
    method: 'post',
  })
}

// 仪器出入库领用
export function useIn(inIds) {
  return request({
    url: '/resource/instrument/outin/in/' + inIds,
    method: 'post',
  })
}

// 仪器出入库归还
export function returnOut(instrumentIds) {
  return request({
    url: '/resource/instrument/outin/in/' + instrumentIds,
    method: 'put',
  })
}

// 保管人批量出库 
export function useAdmin(outinId) {
  return request({
    url: '/resource/instrument/outin/adminOut/' + outinId,
    method: 'put',
  })
}


// 保管人批量入库 {}
export function returnAdmin(outinId) {
  return request({
    url: '/resource/instrument/outin/adminIn/' + outinId,
    method: 'put',
  })
}
